package cn.ztr.ymcc.service.impl;

import cn.ztr.ymcc.domain.Login;
import cn.ztr.ymcc.domain.ShopCar;
import cn.ztr.ymcc.mapper.ShopCarMapper;
import cn.ztr.ymcc.result.JsonResult;
import cn.ztr.ymcc.service.IShopCarService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ztr
 * @since 2023-03-09
 */
@Service
public class ShopCarServiceImpl extends ServiceImpl<ShopCarMapper, ShopCar> implements IShopCarService {



    /**
     * 添加课程到购物车
     * @param shopCar
     * @param login
     * @return
     */
    @Override
    public JsonResult add(ShopCar shopCar, Login login) {
        //获取用户id和用户名
        Long loginId = login.getId();
        String username = login.getUsername();
        shopCar.setUsername(username).setUserId(loginId);
        baseMapper.insert(shopCar);
        return null;
    }
}
